﻿/*  ----------------------------------------------------------------------------
 *  ITGROUP
 *  ----------------------------------------------------------------------------
 *  IBBA Infra Web
 *  ----------------------------------------------------------------------------
 *  File:       Favoritos.aspx.cs
 *  Author:     ITGROUP\eduardog
 *  ----------------------------------------------------------------------------
 */
using System;
using System.Web.UI.WebControls;
using bba.framework.infraweb.baseinfra;
using bba.framework.infraweb.interfaces.controller;
using Microsoft.Practices.Unity;

namespace bba.framework.infraweb.tests.infraWebMode
{
    [Serializable]
    public partial class Favoritos : BasePage
    {
        [Dependency]
        public IFavoritePageController FavoritePageController { get; set; }

        #region Events

        protected void newCategoryButton_Click(object sender, EventArgs e)
        {
            FavoritePageController.addCategory(txtNomeFavorito, hiddenUrl, addButton1, newCategoryTextBox);
        }
        protected void addButton_Click(object sender, EventArgs e)
        {
            FavoritePageController.add(lblMessage, categoryDropDown, txtNomeFavorito, hiddenUrl, addButton1, newCategoryTextBox);
        }
        protected void addFavoriteButton_Click(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                FavoritePageController.addFavorite(this.ViewState, this.favoritesGridView, lblMessage, categoryDropDown, txtNomeFavorito, hiddenUrl, addButton1, newCategoryTextBox);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            FavoritePageController.load(IsPostBack, ViewState, favoritesGridView, lblMessage, categoryDropDown);
        }
        protected void favoritesGridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            FavoritePageController.pageChanged(e.NewPageIndex, ViewState, favoritesGridView);
        }
        protected void favoritesGridView_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            FavoritePageController.deleteRow(e.RowIndex, ViewState, favoritesGridView, lblMessage);
        }

        protected void btnExcluir_Click(object sender, EventArgs e)
        {
            FavoritePageController.deleteCategory(categoryDropDown, lblMessage, ViewState, favoritesGridView);
        }

        #endregion
    }
}
